<?php

class Service_Account
{
	static function loginIsExists($sLogin, $iAccountId = 0)
	{
		$sSql = 'SELECT COUNT(*)
		         FROM accounts
		         WHERE login = ?';
		if ($iAccountId)
		{
		    $sSql .= ' AND id != '.intval($iAccountId);
		}
		$iCnt = DB::scalarSelect($sSql, $sLogin);
		return (bool)$iCnt;
	}
}